﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="POStatusReport.aspx.cs" Culture="en-GB"
    Inherits="Main_Reports_Inventory_POStatusReport" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxControl" %>
<%@ Register Src="~/User Controls/PageHeading.ascx" TagName="heading" TagPrefix="acc" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../../../Styles/accounts.css" rel="stylesheet" type="text/css" />
    <script src="../../../JavaScript/Commons.js" type="text/javascript"></script>
    <style type="text/css">
        #overlay
        {
            position: fixed;
            z-index: 99;
            top: 0px;
            left: 0px;
            background-color: #f8f8f8;
            width: 100%;
            height: 100%;
            filter: Alpha(Opacity=90);
            opacity: 0.9;
            -moz-opacity: 0.9;
        }
        #theprogress
        {
            background-color: #fff;
            border: 1px solid #ccc;
            padding: 10px;
            width: 300px;
            height: 30px;
            line-height: 30px;
            text-align: center;
            filter: Alpha(Opacity=100);
            opacity: 1;
            -moz-opacity: 1;
        }
        #modalprogress
        {
            position: absolute;
            top: 40%;
            left: 50%;
            margin: -11px 0 0 -150px;
            color: #990000;
            font-weight: bold;
            font-size: 14px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeout="4000"
            EnablePageMethods="true" EnablePartialRendering="true">
        </asp:ScriptManager>
        <acc:heading ID="pagehead" runat="server" HeadingText="Purchase Order Status Report" />
        <div>
            <table style="background-color: #EEEEEE; width: 150%; height: 30px;">
                <tr>
                    <td style="width:5%;">
                        <asp:Label ID="lblRecordNo" runat="server"></asp:Label>
                    </td>
                    <td style="width:12%;">
                        <asp:Label ID="lblperiod" runat="server"></asp:Label>
                    </td>
                    <td style="width:7%;">
                        <span>Purchase Order From</span>
                    </td>
                    <td style="width:2%;">
                        <asp:TextBox ID="txtfromdate" CssClass="input" Width="80px" runat="server"></asp:TextBox>
                    </td>
                    <td style="width:2%;">
                        <asp:ImageButton ID="imgfromdate" runat="server" ImageUrl="~/Images/calendar.gif" />
                        <AjaxControl:CalendarExtender ID="calFrom" runat="server" PopupButtonID="imgfromdate"
                            Format="dd/MM/yyyy" TargetControlID="txtfromdate">
                        </AjaxControl:CalendarExtender>
                    </td>
                    <td style="width:2%;">
                        To
                    </td>
                    <td style="width:2%;">
                        <asp:TextBox ID="txttodate" CssClass="input" Width="80px" runat="server" onKeyPress="return isNumberKey(this.id,event);"></asp:TextBox>
                    </td>
                    <td style="width:2%;">
                        <asp:ImageButton ID="imgtoDate" runat="server" ImageUrl="~/Images/calendar.gif" />
                        <AjaxControl:CalendarExtender ID="calto" runat="server" PopupButtonID="imgtoDate"
                            Format="dd/MM/yyyy" TargetControlID="txttodate">
                        </AjaxControl:CalendarExtender>
                    </td>
                    <td style="width:5%;">
                        <asp:Button ID="btngetreport" runat="server" Text="Report" CssClass="button1" OnClick="btngetreport_Click"
                            OnClientClick="return getcheck();" />
                        <script type="text/javascript">
                            function getcheck() {
                                if (document.getElementById("txtfromdate").value == '') {
                                    alert("Please Select From Date.");
                                    document.getElementById("txtfromdate").focus();
                                    return false;
                                }
                                else if (document.getElementById("txttodate").value == '') {
                                    alert("Please Select To Date.");
                                    document.getElementById("txttodate").focus();
                                    return false;
                                }
                            }
                        </script>
                    </td>                   
                    <td align="right" style="width:6%;">
                        <asp:Label ID="lblcolumnName" runat="server" style="display:none;" Text="Column Name"></asp:Label>
                    </td>
                    <td style="width:10%;">
                        <asp:DropDownList ID="ddlColumnname" style="display:none;" runat="server" onchange="return ToHide_Show();"
                            CssClass="dropdown">
                            <asp:ListItem Value="0"> - Select Column(s) - </asp:ListItem>
                            <asp:ListItem Value="1">Item Code</asp:ListItem>
                            <asp:ListItem Value="2">Item Name</asp:ListItem>
                            <asp:ListItem Value="3">PO Number</asp:ListItem>
                            <asp:ListItem Value="4">Currency</asp:ListItem>
                            <asp:ListItem Value="5">Folio No</asp:ListItem>
                            <asp:ListItem Value="6">Vendor Country</asp:ListItem>
                            <asp:ListItem Value="7">Invoice Value</asp:ListItem>
                            <asp:ListItem Value="8">Payment Terms</asp:ListItem>
                        </asp:DropDownList>
                        <script type="text/javascript">
                            function ToHide_Show() {
                                if (document.getElementById("ddlColumnname").value != "0") {
                                    //document.getElementById("txtValue").style["display"] = "block";
                                    //document.getElementById("lblvalue").style["display"] = "block";
                                    //document.getElementById("btnReport").style["display"] = "block";                                                    
                                }
                                else {
                                    //document.getElementById("txtValue").style["display"] = "none";
                                    //document.getElementById("lblvalue").style["display"] = "none";
                                    //document.getElementById("btnReport").style["display"] = "none";
                                }
                                document.getElementById("txtValue").value = '';
                            }
                        </script>
                    </td>
                    <td align="right" style="width:2%;">
                        <asp:Label ID="lblvalue" runat="server" style="display:none;" Text="Value"></asp:Label>
                    </td>
                    <td style="width:5%;">
                        <asp:TextBox ID="txtValue" CssClass="input" style="display:none;" width="80px" runat="server"></asp:TextBox>
                    </td>
                    <td style="width:3%;">
                        <asp:Button ID="btnSearch" runat="server" Text="Search" style="display:none;" CssClass="button1" OnClick="btnSearch_Click" />
                    </td>
                    <td style="width:3%;" align="center">
                        <asp:ImageButton ID="imgbtnPrint" ToolTip="Print" style="display:none;" runat="server" Width="20px" OnClientClick="printpanel();"
                            ImageUrl="../../../Images/print.png" />
                        <script type="text/javascript">
                            function printpanel() {
                                var printcontent = document.getElementById('grdViewPoStatus');
                                window.print(printcontent.innerHTML);
                            }
                        </script>
                    </td>
                    <td style="width:3%; vertical-align:middle;" align="center">
                        <asp:ImageButton ID="ImgBtnExcel" ToolTip="Export to Excel" style="display:none;" runat="server" Width="20px"
                            ImageUrl="~/Images/Excel.png" OnClick="ImgBtnExcel_Click" />
                    </td>
                </tr>
            </table>
            <asp:UpdatePanel ID="UpdateStockreport" runat="server">
                <ContentTemplate>
                    <asp:GridView ID="grdViewPoStatus" runat="server" AutoGenerateColumns="False" CssClass="gridview"
                        ShowHeaderWhenEmpty="false" ShowFooter="true" Width="100%" OnPageIndexChanging="grdViewPoStatus_PageIndexChanging"
                        OnDataBound="OnDataBound" OnRowDataBound="grdViewPoStatus_RowDataBound">
                        <Columns>
                            <asp:TemplateField HeaderText="S.No">
                                <ItemTemplate>
                                    <%#Container.DataItemIndex + 1 %>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <%--For Item Table--%>
                            <asp:BoundField HeaderText="PO NO" DataField="PONO" ItemStyle-BackColor="#96ECF5" HeaderStyle-Width="100%"></asp:BoundField>
                            <asp:BoundField HeaderText="PO DATE" DataField="PODATE" ItemStyle-BackColor="#96ECF5" DataFormatString="{0:dd/MM/yyyy}"></asp:BoundField>
                            <asp:BoundField HeaderText="Item Code" DataField="ITMCODE" HeaderStyle-Width="5px"></asp:BoundField>
                            <asp:BoundField HeaderText="Item Name" DataField="ITMDESC" HeaderStyle-Width="750px"></asp:BoundField>
                            <asp:BoundField HeaderText="MPN" DataField="MPNNO" FooterText="Total" FooterStyle-Font-Bold="true" FooterStyle-Font-Size="12px"></asp:BoundField>
                            <%--For Purchase Order--%>
                            <asp:BoundField HeaderText="PO Item Qty" DataField="POQTY" ItemStyle-BackColor="#96ECF5" DataFormatString="{0:0}" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right"></asp:BoundField>
                            <asp:BoundField HeaderText="UNIT PRICE [PO]" DataField="POUNITPRICE" ItemStyle-BackColor="#96ECF5" DataFormatString="{0:0.000}"  ItemStyle-HorizontalAlign="Right"></asp:BoundField>                            
                            <asp:BoundField HeaderText="PO Value" DataField="POVALUE" ItemStyle-BackColor="#96ECF5" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right"></asp:BoundField>
                            <asp:BoundField HeaderText="Currency" DataField="CURRENCY" ItemStyle-BackColor="#96ECF5"></asp:BoundField>
                            <%--For Purchase Receive--%>
                            <asp:BoundField HeaderText="Folio No" DataField="FOLIONO" ItemStyle-BackColor="#94FCB8" ItemStyle-HorizontalAlign="Right"></asp:BoundField>
                            <asp:BoundField HeaderText="Invoice No [Vendor]" ItemStyle-BackColor="#94FCB8" DataField="INVOICENO"></asp:BoundField>                            
                            <asp:BoundField HeaderText="Invoice Date [Vendor]" DataField="INVOICEDATE" ItemStyle-BackColor="#94FCB8" DataFormatString="{0:dd/MM/yyyy}"></asp:BoundField>
                            <asp:BoundField HeaderText="Invoice Value" DataField="INVOICEVALUE" ItemStyle-BackColor="#94FCB8" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right"></asp:BoundField>
                            <asp:BoundField HeaderText="TAT [Invoice Date-PO Date]" ItemStyle-HorizontalAlign="Right" ItemStyle-BackColor="#94FCB8" DataField="TAT" />
                            <asp:BoundField HeaderText="Vendor Name" DataField="VENDORNAME" ItemStyle-BackColor="#94FCB8"></asp:BoundField>
                            <asp:BoundField HeaderText="Vendor City" DataField="CITY" ItemStyle-BackColor="#94FCB8"></asp:BoundField>
                            <asp:BoundField HeaderText="Vendor Country" DataField="COUNTRY" ItemStyle-BackColor="#94FCB8"></asp:BoundField>
                                                        
                            <asp:BoundField HeaderText="Receive Date" DataField="RECEIVEDATE" ItemStyle-BackColor="#94FCB8" DataFormatString="{0:dd/MM/yyyy}"></asp:BoundField>
                            <asp:BoundField HeaderText="Received Qty" DataField="PORECQTY" DataFormatString="{0:0}" ItemStyle-BackColor="#94FCB8" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right"></asp:BoundField>
                            <asp:BoundField HeaderText="Unit Price[Invoice]" DataField="UNITPRICE" ItemStyle-BackColor="#94FCB8" ItemStyle-HorizontalAlign="Right"></asp:BoundField>
                            <asp:BoundField HeaderText="Received Item Value [Invoice]" DataField="RecItemValue" DataFormatString="{0:0.00}" ItemStyle-BackColor="#94FCB8" ItemStyle-HorizontalAlign="Right"></asp:BoundField>
                            <asp:BoundField HeaderText="Landed Cost [INR]" DataField="PORECVALUE" ItemStyle-BackColor="#94FCB8" ItemStyle-HorizontalAlign="Right" FooterStyle-HorizontalAlign="Right"></asp:BoundField>
                            <asp:BoundField HeaderText="Transit Time[Purchase Receive Date-Invoice Date]" DataField="TRANSITTIME" ItemStyle-HorizontalAlign="Right" ItemStyle-BackColor="#94FCB8"/>
                            <asp:BoundField HeaderText="Total Lead Time[TAT+ Transit Time]" ItemStyle-HorizontalAlign="Right" DataField="TotalLeadTime" ItemStyle-BackColor="#94FCB8" />
                            <asp:BoundField HeaderText="Payment Terms" DataField="PAYMENTTERMS" ItemStyle-BackColor="#94FCB8"></asp:BoundField>
                            <asp:BoundField HeaderText="Leased Type" DataField="Leasedtype" ItemStyle-BackColor="#94FCB8"></asp:BoundField>
                        </Columns>
                    </asp:GridView>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
    </div>
    </form>
</body>
</html>
